<template>
    <el-main>
        <el-card class="box-card">
            {{msg}}
        </el-card>
    </el-main>
</template>
<script>
import {HttpHandler} from '@/api/Gener.js'
export default {
    data(){
        return{
            msg:'',
            FK_Flow:''
        }

    },
    methods:{
        initData:function(){
            this.FK_Flow = this.$route.params.FK_Flow;
            this.myView_Init();

        },
        myView_Init:function(){
            var handler = new HttpHandler("BP.WF.HttpHandler.WF_MyView");
            handler.AddJson(this.$route.params);
            var data = handler.DoMethodReturnString("MyView_Init");
            //处理数据
            if (data.indexOf('err@') == 0) {
                this.msg="<br>" + data;
                return;
            }
            if (data.indexOf('url@') == 0) {
                data = data.replace('url@', ''); //如果返回url，就直接转向.
                data = data.replace('?DoType=HttpHandler', '?');
                data = data.replace('&DoType=HttpHandler', '');
                data = data.replace('&DoMethod=MyView_Init', '');
                data = data.replace('&HttpHandlerName=BP.WF.HttpHandler.WF_MyCC', '');
                data = data.replace('?&', '?');
                 //获取跳转的路由
                var routerName = data.substr(data.lastIndexOf("/")+1,data.indexOf('?'));
                routerName = routerName.replace(".html","").replace(".htm","");
                //获取？号后面的参数
                var params = data.substr(data.indexOf('?')+1).split('&');
                var myJson = {};
                for (var i = 0; i < params.length; i++) {
                    var hash = params[i].split('=');
                    if(hash[0]!="HttpHandlerName" && hash[0]!="DoMethod")
                        myJson[hash[0]] = hash[1];
                }
                myJson["IsShowBtn"] = 1;
                // vuex 保存数据
                this.$store.commit('setData', myJson)
                //如果返回url，就直接转向.
                this.$router.push({
                    name: routerName,
                    params:myJson
                });
                return;
            }
            this.msg= data;
        }
    },
    created(){
        this.initData();
        
    }
}
</script>